<style>

.dtable{display:table;width:auto;margin:0px auto;border-collapse:collapse;line-height:25px;}
.drow{display:table-row;height:25px;line-height:25px; vertical-align:top;}
.dfirstcell{display:table-cell;text-align:center;width:30px;border:1px solid #666;}
.dnamecell{display:table-cell;text-align:center;width:100px;border:1px solid #666;}
.dtelecell{display:table-cell;text-align:center;width:100px;border:1px solid #666;}
.demailcell{display:table-cell;text-align:center;width:150px;border:1px solid #666;}
.dcontentcell{display:table-cell;text-align:center;width:380px;border:1px solid #666;}
.dlangcell{display:table-cell;text-align:center;width:80px;border:1px solid #666;}
.dtimecell{display:table-cell;text-align:center;width:120px;border:1px solid #666;}
.dhandlecell{display:table-cell;text-align:center;width:120px;border:1px solid #666;}

.dlcell{}
.drcell{}


#replyShade{display:none;position:absolute;z-index:99;background-color:#C7EDCC;filter:alpha(opacity=80);opacity:0.8;z-index:99;width:100%;height:100%;}
#replyForm{display:none;position:absolute;z-index:100;background-color:#FFF;text-align:center;left:50%;top:25%;margin:0 0 0 -250px;width:600px;border:1px dotted #063;padding:8px;}
#replyForm textarea{width:400px;height:100px;}

</style>
<script type="text/javascript">
jQuery(function(){
	$('#cancel').click(function(){
		$('#replyShade').hide();
		$('#replyForm').hide();
	});
	
	$('#_replyForm').submit(function(){
		var reply = $('#_reply').attr('disabled') ? '' : $('#_reply').val();
		var sendmail = $('#sendmail').attr('checked') ? 1 : 0;
		var data = {"id":$('#gid').val(), "reply": reply, "note":$('#_note').val(), 'sendmail':sendmail};
		$.post('admin.php?mo=action&mo=guestbook&do=replyNoteGuestbook&ajax=1', data, function(res){
			if (res.result && reply) {
				$('#_reply').attr('disabled', true);
			}
			alert(res.msg);
		}, 'json');
		return false;
	});
});
function replyDialog(id)
{
	var allWidth		= $(window).width();
	var allHeight		= $(window).height();
	$('#replyShade').show().width(allWidth).height(allHeight);
	$('#replyForm').show();
	$('#gid').val(id);
	$.getJSON('/admin.php?mo=action&mo=guestbook&do=readGuestBook&ajax=1&id='+id, function(json){
		if (json.reply) {
			$('#_reply').val(json.reply).attr('disabled', true);
		}
		$('#_note').val(json.note);
	});
}
function viewall(id)
{
	var idstr = '#content'+id;
	$(idstr).attr('simple', $(idstr).html());
	$(idstr).html($(idstr).attr('data'));
	$('#viewall'+id).hide();
	$('#viewsimple'+id).show();
}
function viewsimple(id)
{
	var idstr = '#content'+id;
	$(idstr).html($(idstr).attr('simple'));
	$('#viewall'+id).show();
	$('#viewsimple'+id).hide();
}
</script>
<div id="replyShade">
</div>
<div id="replyForm" class="dtable">
<form id="_replyForm" name="replyForm" method="post">
<input type="hidden" name="id" id="gid" value="" />
	<table width="550" align="center">
    	<tr>
          <td width="80" align="right" valign="top">{$ReplyText}:</td>
    	  <td><textarea id="_reply" name="reply" cols="" rows=""></textarea></td>
    	</tr>
    	<tr>
          <td align="right" valign="top"></td>
    	  <td align="left">
          <input id="sendmail" name="sendmail" type="checkbox" value="1" />&nbsp;&nbsp;&nbsp;&nbsp;{$ReplySendEmailText}
          </td>
    	</tr>
    	<tr>
          <td align="right" valign="top">{$NoteText}: </td>
    	  <td><textarea id="_note" name="note" cols="" rows=""></textarea></td>
    	</tr>
    	<tr>
          <td colspan="2" align="center">
          <input type="submit" value="{$SubmitText}" />
          <input type="reset" id="cancel" value="{$CancelText}" />
          </td>
   	    </tr>
    </table>
</form>
</div>
<div id="main">
    <div class="dtable">
        <div class="drow">
            <span class="dfirstcell"></span>
            <span class="dnamecell">{$GuestNameText}</span>
            <span class="dtelecell">{$TelephoneText}</span>
            <span class="demailcell">{$EmailText}</span>
            <span class="dcontentcell">{$LeaveWordContentText}</span>
            <span class="dlangcell">{$LangText}</span>
            <span class="dtimecell">{$LeaveWordTimeText}</span>
            <span class="dhandlecell">{$HandleText}</span>
        </div>
        {loop $list $v}
        <div class="drow">
            <span class="dfirstcell"></span>
            <span class="dnamecell">{$v['guestname']}</span>
            <span class="dtelecell">{$v['telephone']}</span>
            <span class="demailcell">{$v['email']}{if $v['is_sentemail']} ({$IsSentMailText}){/if}</span>
            <span class="dcontentcell">
            {if mb_strlen($v['content'])>20}
                <span id="content{$v['id']}" data="{$v['content']}">{echo mb_substr($v['content'], 0, 15)}</span>
                <a id="viewall{$v['id']}" href="javascript:viewall({$v['id']});" style="color:#06C">&gt;&gt;&gt;{$ExpandContentText}</a>
                <a id="viewsimple{$v['id']}" href="javascript:viewsimple({$v['id']});" style="color:#06C;display:none">&lt;&lt;&lt;{$IndentContentText}</a>
            {else}
            	{echo $v['content']}
            {/if}
            </span>
            <span class="dlangcell">{$GLOBALS['lang_version_list'][$v['lang']]}</span>
            <span class="dtimecell">{echo date('Y-m-d H:i', $v['create_time'])}</span>
            <span class="dhandlecell">
            	<a href="javascript:replyDialog({$v['id']});">{$ReplyNoteText}</a>
            	<a href="admin.php?mo=action&do=leaveWordDelete&id={$v['id']}">{$DeleteText}</a>
            </span>
        </div>
        {/loop}
    </div>
</div>